.class public Lcom/zuiapps/suite/utils/device/WifiUtil;
.super Ljava/lang/Object;
.source "WifiUtil.java"


# instance fields
.field private mContext:Landroid/content/Context;

.field private mWifiManager:Landroid/net/wifi/WifiManager;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 16
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 17
    iput-object p1, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mContext:Landroid/content/Context;

    .line 18
    const-string v0, "wifi"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/wifi/WifiManager;

    iput-object v0, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mWifiManager:Landroid/net/wifi/WifiManager;

    .line 19
    return-void
.end method


# virtual methods
.method public closeWifi()Z
    .registers 6

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 50
    iget-object v3, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mWifiManager:Landroid/net/wifi/WifiManager;

    invoke-virtual {v3}, Landroid/net/wifi/WifiManager;->isWifiEnabled()Z

    move-result v3

    if-eqz v3, :cond_1b

    .line 52
    :try_start_a
    iget-object v3, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mWifiManager:Landroid/net/wifi/WifiManager;

    const/4 v4, 0x0

    invoke-virtual {v3, v4}, Landroid/net/wifi/WifiManager;->setWifiEnabled(Z)Z

    move-result v0

    .line 53
    .local v0, "isSucc":Z
    if-nez v0, :cond_1b

    .line 54
    new-instance v1, Ljava/lang/Exception;

    invoke-direct {v1}, Ljava/lang/Exception;-><init>()V

    throw v1
    :try_end_19
    .catch Ljava/lang/Exception; {:try_start_a .. :try_end_19} :catch_19

    .line 57
    .end local v0    # "isSucc":Z
    :catch_19
    move-exception v1

    move v1, v2

    .line 62
    :cond_1b
    return v1
.end method

.method public isEnabled()Z
    .registers 4

    .prologue
    const/4 v0, 0x0

    .line 23
    :try_start_1
    iget-object v1, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mWifiManager:Landroid/net/wifi/WifiManager;

    invoke-virtual {v1}, Landroid/net/wifi/WifiManager;->getWifiState()I
    :try_end_6
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_6} :catch_c

    move-result v1

    const/4 v2, 0x3

    if-ne v1, v2, :cond_b

    const/4 v0, 0x1

    .line 27
    :cond_b
    :goto_b
    return v0

    .line 24
    :catch_c
    move-exception v1

    goto :goto_b
.end method

.method public openWifi()Z
    .registers 5

    .prologue
    const/4 v1, 0x1

    .line 32
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mWifiManager:Landroid/net/wifi/WifiManager;

    invoke-virtual {v2}, Landroid/net/wifi/WifiManager;->isWifiEnabled()Z

    move-result v2

    if-nez v2, :cond_1a

    .line 34
    :try_start_9
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mWifiManager:Landroid/net/wifi/WifiManager;

    const/4 v3, 0x1

    invoke-virtual {v2, v3}, Landroid/net/wifi/WifiManager;->setWifiEnabled(Z)Z

    move-result v0

    .line 35
    .local v0, "isSucc":Z
    if-nez v0, :cond_1a

    .line 36
    new-instance v1, Ljava/lang/Exception;

    invoke-direct {v1}, Ljava/lang/Exception;-><init>()V

    throw v1
    :try_end_18
    .catch Ljava/lang/Exception; {:try_start_9 .. :try_end_18} :catch_18

    .line 39
    .end local v0    # "isSucc":Z
    :catch_18
    move-exception v1

    .line 42
    const/4 v1, 0x0

    .line 44
    :cond_1a
    return v1
.end method

.method public redictToSettings()V
    .registers 3

    .prologue
    .line 67
    :try_start_0
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.settings.WIFI_SETTINGS"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 68
    .local v0, "settings":Landroid/content/Intent;
    const/high16 v1, 0x10000000

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 69
    iget-object v1, p0, Lcom/zuiapps/suite/utils/device/WifiUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v1, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
    :try_end_11
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_11} :catch_12

    .line 73
    .end local v0    # "settings":Landroid/content/Intent;
    :goto_11
    return-void

    .line 70
    :catch_12
    move-exception v1

    goto :goto_11
.end method
